home *** CD-ROM | disk | FTP | other *** search
- Path: abacus.abasoft.co.uk!not-for-mail
- From: dmb@abacus.abasoft.co.uk (David Byrne)
- Newsgroups: comp.lang.c++
- Subject: Re: What is wrong with this code?
- Date: 20 Mar 1996 13:12:02 -0000
- Organization: Abacus Software Ltd.
- Message-ID: <4ip072$b9f@abacus.abasoft.co.uk>
- References: <4il0pn$fp@news1.io.org>
- NNTP-Posting-Host: abacus.abasoft.co.uk
- X-NNTP-Posting-Host: abacus.demon.co.uk
-
- vector::~vector (void) {
- if (data) delete data;
- if (name) delete name;
- }
-
- should be
-
- vector::~vector (void) {
- if (data) delete[] data;
- if (name) delete[] name;
- }
-
- However, the program works using g++ 2.7.0:
-
- $ g++ test.cpp
- $ a.out
- Vector 'first' is of dimension 4 and it's parameters are:
-
- first[1] = 1
- first[2] = 2
- first[3] = 3
- first[4] = 4
- Vector 'second' is of dimension 2 and it's parameters are:
-
- second[1] = 1.1
- second[2] = 1.2
- Vector 'unnamed' is of dimension 4 and it's parameters are:
-
- unnamed[1] = 3
- unnamed[2] = 6
- unnamed[3] = 9
- unnamed[4] = 12
-
- $
- --
- David Byrne, Abacus Software, London, UK Tel: +44 (0)171 603 9877
- Email: dmb@abacus.demon.co.uk Fax: +44 (0)171 603 6844
- Here's a koan: If you have ice-cream I will give you some. If you have none,
- I will take it away from you. (it's an ice-cream koan).
-